package com.xyc.study.stu_demo.controller;

import cn.hutool.core.bean.BeanUtil;
import com.xyc.study.stu_demo.entity.UserEntity;
import com.xyc.study.stu_demo.po.StuUserPO;
import com.xyc.study.stu_demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/users")
public class UserController {
    @Autowired
    private UserService userService;

    @PostMapping("page")
    public ResponseEntity<List<StuUserPO>> getUsers(@RequestBody StuUserPO account) {
        return ResponseEntity.ok(userService.getUsers(BeanUtil.copyProperties(account, UserEntity.class)));
    }


}